<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <!-- 多次调用,遵循js的规则,写在后面的执行-->
        <input type="text" v-focus> 
        <input type="text" v-focus>
        <!-- <input type="text" autofocus>
        <input type="text" autofocus> -->
        <!-- html autofocus属性只有第一个被选中 -->
    </div>

    <div id="app2">
        <input type="text" v-focus> 
        <input type="text" v-focus>
    </div>
    <div id="app3">
        <input type="text" v-focus> 
        <input type="text" v-focus>
    </div>
    <!-- 多个Vue实例只能选中一个input为聚焦状态 -->
</body>
<script>
    Vue.directive('focus', {
        inserted(el) {
            el.focus()
        }
    });

    new Vue({
        el: '#app'
    })

    new Vue({
        el: '#app2'
    })

    new Vue({
        el: '#app3'
    })



</script>
</html>